C-Level Extensibility > The C-level extensibility API > JSObject *JS_NewArrayObject()

 

JSObject *JS_NewArrayObject()

Description

Creates a new object that contains an array of jsvals.

Arguments

JSContext *cx, unsigned int length, jsval *v

cx is the opaque JSContext pointer that was passed to the JavaScript function.
length is the number of elements that the array will hold.
v is an optional pointer to the jsvals to be stored in the array. If the return value is not null, v is an array containing length elements. If the return value is null, then the initial content of the array object is undefined (and may be set using JS_SetElement()).

Returns

A pointer to a new array object, or null upon failure.